/**
 * @file databuf.c
 * @author your name (you@domain.com)
 * @brief 
 * @version 0.1
 * @date 2023-08-24
 * 
 * @copyright Copyright (c) 2023
 * 
 */

#ifndef DATABUF_H
#define DATABUF_H


/******************************* Includes ********************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef __cplusplus
extern "C"
{
#endif

/******************************* Macros ******************************/

#define DATABUF_E(...)  printf(__VA_ARGS__)
#define DATABUF_I(...)  printf(__VA_ARGS__)
#define DATABUF_D(...)  printf(__VA_ARGS__)

/******************************* Typedef ******************************/

/******************************* Variables ******************************/

/******************************* Functions ******************************/

typedef void* DataBufHandle;

DataBufHandle DataBufferCreate(int size);
int           DataBufferDestroy(DataBufHandle handle);
int           DataBufferPeek(char *dst, int readlen, DataBufHandle handle);
int           DataBufferClear(DataBufHandle handle);
int           DataBufferGetFreeSize(DataBufHandle handle);
int           DataBufferGetDataSize(DataBufHandle handle);
int           DataBufferWrite(DataBufHandle handle, char *src, int writelen);
int           DataBufferRead(char *dst, int readlen, DataBufHandle handle);

#ifdef __cplusplus
}
#endif

#endif
/******************************* End of file ******************************/











